package com.example.communitysystem.mapper;

import com.example.communitysystem.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface UserMapper {

    //添加一个用户
    public Integer insertUser(User user);

    //@Select("select * from user where token = #{token}")
    //通过用户登录的token信息查找用户
    User findByToken(@Param("token") String token);

    //通过id查找用户
    User findById(@Param(value = "id") Long creatorId);

    //通过用户名查找用户
    User findByLoginName(@Param(value = "loginName") String loginName);

    //通过码云上用户的accountId查找用户
    User findByAccountId(@Param("accountId")String accountId);

    //更新用户信息
    Integer updateUser(User user);
}
